package com.neusoft.ysu.npms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neusoft.ysu.npms.mapper.HelpMapper;
import com.neusoft.ysu.npms.mapper.LeaderMapper;
import com.neusoft.ysu.npms.pojo.Help;
import com.neusoft.ysu.npms.pojo.Helpman;
import com.neusoft.ysu.npms.pojo.Leader;
import com.neusoft.ysu.npms.pojo.Result;
import com.neusoft.ysu.npms.service.ILeaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者：刘金秋
 * @since 2024-06-18
 */
@Service
public class LeaderServiceImpl extends ServiceImpl<LeaderMapper, Leader> implements ILeaderService {
    @Autowired
    LeaderMapper leaderMapper;

    @Override
    public Result add(Leader leader) {
        return new Result<>(0, "", leaderMapper.add(leader));
    }

    @Override
    public Result deleteLeader(Leader leader){
        return new Result<>(0,"",leaderMapper.deleteLeader(leader));
    }

    @Override
    public Result updateLeader(Leader leader){
        return new Result<>(0,"",leaderMapper.updateLeader(leader));
    }

    @Override
    public PageInfo selectAll(Leader leader,int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<Leader> infos=leaderMapper.selectAll(leader);
        return new PageInfo(infos);
    }
    @Override
    public Result findById(Leader leader){
        return new Result<>(0,"",leaderMapper.findById(leader));
    }
}
